Introduction

The Apama Event Processing Language (EPL) is the native language of the Apama correlator. You use EPL to write programs that process events in the correlator. This EPL reference is a companion to the Apama EPL tutorials in Apama Plugin for Eclipse and Developing Apama applications in EPL, which you can use to learn how to write programs in EPL. Use this EPL reference to answer questions and obtain complete details about a particular construct.

EPL is a flexible and powerful curly-brace, domain-specific, language designed for writing programs that process events.

In EPL, an event is a data object that contains a notification of something that has happened, such as a customer order was shipped, a shipment was delivered, a sensor state change occurred, a stock trade took place, or myriad other things. Each kind of event has an event type name and one or more data elements (called event fields) associated with it. External events are received by one or more adapters, which receive events from an event source and translate them from a source-specific format into Apama’s internal canonical format. Derived events can be created as needed by EPL programs.

Note: MonitorScript is the old name for EPL. You might still see the old name in the product documentation.

Hello World example

Though it contains many of the familiar constructs and features found in general-purpose programming languages like Python or Java, EPL also has special features to make it easy to aggregate, filter, correlate, transform, act on, and create events in a concise manner. Here is the canonical “hello world” example written in EPL:

monitor HelloWorld
{
   action onload()
   {
      print "Hello world!";
   }
}

The Apama event processor, called the correlator, receives events of various types from external sources and routes them to one or more active EPL programs, called monitors.

Monitors have registered event handlers, called listeners, for events of particular types with specific combinations of data values or ranges of values. When the correlator detects an event of interest, it calls the appropriate event handlers. If there are no handlers for an event, the correlator discards it or passes it to an event handler specifically for events that have no handler.

Event handlers in EPL are conceptually similar to methods or functions used for handling user-interface events in other languages, such as Java Swing or SWT applications. In EPL, code is executed only in response to events. Except, that is, for the special EPL onload(), ondie(), and onunload() actions. See Monitor lifecycle for information about these actions.